#pragma once
#include <string>
#include <vector>
#include <QObject>
//JSON
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/prettywriter.h" // for stringify JSON
using namespace rapidjson;

class NodeHandle :public QObject
{
	Q_OBJECT

public:
	typedef struct tagSubscriberMessage
	{
		int topic_number;
		char* spilt_char;
		std::vector<char*> topic_name;
		std::vector<int> topic_id;
		std::vector<int> topic_maxnumber;
	}SubscriberMessage;
	
	NodeHandle(QObject * parent = Q_NULLPTR);
	void subscribe(char* topicName, int topic_ID, int topic_maxNumber);
	int desSubscribe(char* topicName, int topic_ID);
	int toString(char* buffer);
	const SubscriberMessage& getSubscriberMessage();


private:
	SubscriberMessage subscribeMessage;
	std::string topicNameStr;
	const static char* SUBSCRIBEMESSAGE;
};
